local HASH_SCREEN_SESSION_PROJECT = KEYS[1]
local SET_SCREEN_PROJECT_SESSION = KEYS[2]
local sessionKey = KEYS[3]
local projectId = KEYS[4]

local exist_projectId = redis.call("HGET",HASH_SCREEN_SESSION_PROJECT,sessionKey)
if exist_projectId then
    redis.call("srem",SET_SCREEN_PROJECT_SESSION..":"..exist_projectId,sessionKey)
end

redis.call("HSET",HASH_SCREEN_SESSION_PROJECT,sessionKey,projectId)
redis.call("sadd",SET_SCREEN_PROJECT_SESSION..":"..projectId,sessionKey)

return "1"